<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="dashboard/header :: header"></head>
<body>

<!--
@desc  添加
@author WeiXiaoJin
@since 2019-05-18 23:04:49
-->
	<div layout:fragment="content">
		<div class="container-fluid content-main">
			<div class="animated fadeIn">
				<div class="row">
					<!-- /.col-->
					<div class="col-sm-12">
						<div class="card">
							<div class="card-body">

								<form class="form-horizontal" id="addForm" style="float:left;width:100%">
								
									<input type="hidden" name="formToken" th:value="${session.formToken}" />

									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">菜单名称</label>
										<div class="col-md-9">
											<input class="form-control" id="menusName" type="text" name="menusName" placeholder="菜单名称">
										</div>
									</div>
									<!-- 
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">菜单图标</label>
										<div class="col-md-9">
											<input class="form-control" id="menusIcons" type="text" name="menusIcons" placeholder="菜单图标">
										</div>
									</div>
									 -->
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">图标</label>
										<div class="col-md-9">
											<span class="form-control select-icons" id="menusIconsLabel" type="text" 
											       onclick="showFontIcons('menusIcons','50')" 
											       name="menusIconsLabel" 
												   readonly="readonly" style="padding-top: 6px;cursor: pointer;color:#02619a;text-align:center" placeholder="图标">
											</span>
											<input type="hidden" name="menusIcons" id="menusIcons" />
										</div>
									</div>
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">菜单链接</label>
										<div class="col-md-9">
											<input class="form-control" id="menusLink" type="text" name="menusLink" placeholder="菜单链接">
										</div>
									</div>
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">主导航</label>
										<div class="col-md-9">
											<!-- 
											<input class="form-control" id="hasNav" type="text" name="hasNav" placeholder="是否主导航">
											 -->
											<label class="checkbox-inline"><input type="checkbox" value="1" name="hasNav" id="hasNav" checked="checked">是</label>
										</div>
									</div>
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">排序顺序</label>
										<div class="col-md-9">
											<input class="form-control" id="menusSort" type="text" name="menusSort" placeholder="排序顺序">
										</div>
									</div>
									
									<!-- 
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">所属类型</label>
										<div class="col-md-9">
											<input class="form-control" id="typeId" type="text" name="typeId" placeholder="所属类型">
										</div>
									</div>
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">状态</label>
										<div class="col-md-9">
											<label class="checkbox-inline"><input type="checkbox" value="_blank" name="menusDesignStatus" id="openTarget">规划中</label>
											<label class="checkbox-inline"><input type="checkbox" value="_self" name="menusDesignStatus" id="openTarget">运行中</label>
										</div>
									</div>
									 -->
									 
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">父类</label>
										<div class="col-md-9">
											<!-- 
											<input class="form-control" id="parentMenusId" type="text" name="parentMenusId" placeholder="父类菜单">
											 -->
											 <select class="form-control" name="parentMenusId" id="parentMenusId">
												<option value="0">父类</option>
												<option th:each="item:${menus}" th:value="${item.id}" th:text="${item.menusName}">Java</option>
											</select>
										</div>
									</div>
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">打开目标</label>
										<div class="col-md-9">
											<!-- 
											<input class="form-control" id="openTarget" type="text" name="openTarget" placeholder="打开目标">
											 -->
											 <div class="radio">
												<label class="checkbox-inline"><input type="radio" value="_blank" name="openTarget" id="openTarget"> 新标签</label>
											</div>
											<div class="radio">
												<label class="checkbox-inline"><input type="radio" value="_self" name="openTarget" id="openTarget" checked="checked"> 本窗口</label>
											</div>
										</div>
									</div>
															
								</form>
							</div>
						</div>
						
					</div>
					<!-- /.col-->
				</div>
			</div>
		</div>

	</div>

	<footer th:replace="dashboard/footer :: footer"></footer>
	<script type="text/javascript" th:src="@{/resources/js/project.js}"></script>

	<script type="text/javascript">
		
		var addForm = $("#addForm") ; 
		$(function(){
			addForm.validate({
				ignore: [],  
				rules: {
					menusName: "required" ,
					menusIcons: "required" ,
					menusLink: {required:true} ,
					openTarget: "required" ,
					typeId : "required" ,
					parentMenusId : "required" ,
					menusSort : {required:true,number:true} ,
				}
			});
		}) ;

		function submitHandler() {
			var result = $.validate.form("addForm");
			if(result){
				$.operate.save(ctx+"portal/desktop/web/menus/save" , $('#addForm').serialize());
			}
	    }
		
	</script>

</body>
</html>

